package com.example.myapplication.tack_24.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.myapplication.R;
import com.example.myapplication.tack_24.DetailActivity;
import com.example.myapplication.tack_24.data.FenLeiData;
import com.example.myapplication.tack_24.data.OrderData;
import com.example.myapplication.utils.Common;
import com.example.myapplication.utils.OkHttpTool;

import java.util.List;

public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.My> {
    private List<OrderData.DataDTO.StepListDTO> list;
    private Context context;
    private View view;
    public OrderAdapter(List<OrderData.DataDTO.StepListDTO> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @NonNull
    @Override
    public My onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        view = LayoutInflater.from(context).inflate(R.layout.tack_24_logistics_info,null);
        return new My(view);
    }

    @Override
    public void onBindViewHolder(@NonNull My holder, int position) {
        holder.stateName.setText(list.get(position).getStateName());
        holder.eventAt.setText(list.get(position).getEventAt());
        holder.addressAt.setText(list.get(position).getAddressAt());



    }

    @Override
    public int getItemCount() {
        return list != null?list.size():0;
    }

    public class My extends RecyclerView.ViewHolder{
        private TextView stateName;
        private TextView eventAt;
        private TextView addressAt;

        public My(@NonNull View itemView) {
            super(itemView);
            stateName = view.findViewById(R.id.stateName);
            eventAt = view.findViewById(R.id.eventAt);
            addressAt = view.findViewById(R.id.addressAt);
        }
    }
}
